package com.mnsq.message.bean.condition;

import com.mnsq.common.bean.condition.CommonBaseCondition;
import com.mnsq.common.bean.entity.message.Message;
import lombok.Data;

/**
 * @author 周俭
 */
@Data
public class MessageCondition extends CommonBaseCondition {
    private Integer type;
    private Integer whetherRead;
    private String senderName;
    private String htmlText;
    private Long targetUserId;
    private Long senderUserId;

    @Override
    public Object getInstance() {
        return new Message();
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    public boolean valid() {
        if (this.type == null || this.type < 0 || this.type > 1) {
            return false;
        }
        if (this.targetUserId == null) {
            return false;
        }
        return true;
    }
}
